﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;

namespace Water.Architecture2.IDAL
{
    public class WhereFieldEnumerator:IEnumerator
    {
        private List<WhereField> _whereFields = new List<WhereField>();
        private int position = -1;

        public WhereFieldEnumerator(List<WhereField> list)
        {
            this._whereFields = list;
        }


        #region IEnumerator 成员

        public object Current
        {
            get
            {
                try
                {
                    return this._whereFields[this.position];
                }
                catch (IndexOutOfRangeException)
                {
                    throw new InvalidOperationException();
                }
            }
        }

        public bool MoveNext()
        {
            this.position++;
            return (this.position < this._whereFields.Count);
        }

        public void Reset()
        {
            this.position = -1;
        }

        #endregion
    }
}
